from django.db import models

# Create your models here.


class Comment(models.Model):
    eid = models.AutoField(primary_key=True)
    content = models.TextField(blank=True, null=True) #评论
    send_time = models.DateField(blank=True, null=True) #评论时间
    user_name = models.CharField(max_length=32, blank=True, null=True) #用户名
    shop_star = models.FloatField(blank=True, null=True) #评分
    shop_url = models.CharField(max_length=32, blank=True, null=True) #店铺url


class Shop(models.Model):
    sid = models.AutoField(primary_key=True)
    shop_url = models.IntegerField(blank=True, null=True)  # 店铺id
    city = models.CharField(max_length=64, blank=True, null=True) #城市
    shop_name = models.CharField(max_length=64, blank=True, null=True) #店铺名
    shop_star = models.FloatField(blank=True, null=True)  # 评分
    shop_avg_price = models.IntegerField(blank=True, null=True)  # 人均
    shop_review_num = models.IntegerField(blank=True, null=True)  # 评论数
    shop_type = models.CharField(max_length=32, blank=True, null=True) #店铺类型
    shop_local = models.CharField(max_length=64, blank=True, null=True) #店铺位置
    shop_recommend = models.CharField(max_length=64, blank=True, null=True) #推荐菜
    comments = models.ManyToManyField(Comment)


class SpiderLog(models.Model):
    id = models.AutoField(primary_key=True)
    spider_time = models.DateTimeField(auto_now_add=True)
